# Contributor: Kevin Daudt <kdaudt@alpinelinux.org>
# Maintainer: Kevin Daudt <kdaudt@alpinelinux.org>
pkgname=py3-maxminddb
pkgver=1.5.4
pkgrel=0
pkgdesc="Python MaxMind DB reader extension"
url="http://maxminddb.readthedocs.org/"
arch="all"
license="Apache-2.0"
depends="python3"
makedepends="libmaxminddb-dev python3-dev py3-setuptools"
checkdepends="py3-nose py3-mock"
_test_data_commit=e3764a229ff98541884a3cd4bd7dc95f4ae5d466
source="$pkgname-$pkgver.tar.gz::https://github.com/maxmind/MaxMind-DB-Reader-python/archive/v$pkgver.tar.gz
	MaxMind-DB-test-data-$_test_data_commit.tar.gz::https://github.com/maxmind/MaxMind-DB/archive/$_test_data_commit.tar.gz"

builddir="$srcdir/MaxMind-DB-Reader-python-$pkgver"

prepare() {
	cd "$srcdir"

	# Submodule required for tests
	cp -r "MaxMind-DB-$_test_data_commit/"* "$builddir/tests/data"

	default_prepare
}

build() {
	python3	setup.py build
}

check() {
	python3	setup.py test
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="a4a913ff288355f4efa56f6075b299f8d76f9ec76dc87d9e048aad13d9443aacb729ed1e6f1759c1f76605e7c74232f163d7eaacb3f94ba43b183e745216e1d7  py3-maxminddb-1.5.4.tar.gz
618bef60b69492aecd06467428e36d7a10f2aa846e7afd507b6eac1f3a6ceceeb14ed95654b629c9d2638634a5184658236b644edccc99ae2d24e35d9d1f6db9  MaxMind-DB-test-data-e3764a229ff98541884a3cd4bd7dc95f4ae5d466.tar.gz"
